<?php $this->registerCssFile("@web/css/swiper.min.css",['depends'=>['app\assets\AppAsset']]);?>
<?php $this->registerCssFile('@web/css/index.css',['depends'=>['app\assets\AppAsset']]) ?>
<?php $this->registerJsFile("@web/js/swiper.jquery.min.js",['depends'=>['app\assets\AppAsset']]);?>
<?php $this->registerJsFile("@web/js/laydate.js",['depend'=>['app\assets\AppAsset']]) ?>
<div class="search">
	<form class="form form-inline" method="post" action="?r=list/find">
		<div class="form-group">
			<label for="thing-type">失物类别</label>
			<select name="thing-type" id="thing-type">
				<?php foreach($types as $key => $value){ ?>
				<option><?=$value["name"] ?></option>
				<?php } ?>
			</select>
		</div>
		<div class="form-group">
			<label>丢失日期</label>
			<input type="text" name="start-time" class="lftime" placeholder="开始日期" onclick="laydate()">
			~
			<input type="text" name="end-time" class="lftime" placeholder="结束日期" onclick="laydate()">
		</div>
		<div class="form-group">
			<input name="_csrf" type="hidden" id="_csrf" value="<?= Yii::$app->request->csrfToken ?>">
			<input type="text" name="key-words" placeholder="请输入关键词">
			<button type="submit" name="submit" class="btn btn-default btn-sm">筛选</button>
		</div>
	</form>
</div>
<div class="things">
	<div class="swiper-container">
		<div class="swiper-wrapper">
			<?php
			$total=&$finds;
			$count=count($total);
			$n=intval(($count-1)/9)+1;
			//  一共有几页
			for ($i = 0; $i < $n; $i++){
				//每一页有几个
				?>
				<div class="swiper-slide">
					<?php
					for($j = 0; $j < ($count-9*$i)&&($j<9);$j++){
						$index=$i*9+$j;
						?>
						<div class="thing-mol col-sm-4 clearfix type-find" id="<?=$total[$index]["id"] ?>" data-type="<?=$total[$index]["class"] ?>">
							<div class="thing-img pull-left"><img src="<?= $total[$index]["img_url"]?\yii\helpers\Url::to("@web/".$total[$index]["img_url"]):\yii\helpers\Url::to("@web/images/block.jpg"); ?>"></div>
							<div class="thing-details pull-left">
								<p class="lost-find">招领</p>
								<p class="type">物品: <span class="#"><?=$total[$index]["name"] ?></span></p>
								<p class="place">地点: <span class="#"><?=$total[$index]["place"] ?></span></p>
								<p class="time">时间: <span class="#"><?=$total[$index]["time"] ?></span></p>
								<div class="publish-time">
									发布时间: <span><?=date("Y-m-d H:i",$total[$index]["publish_time"]) ?></span>
								</div>
								<p class="link-this-details"><a href="<?= \yii\helpers\Url::to(["details/find_details","id"=>$total[$index]["id"]]) ?>">查看详情>></a></p>
							</div>
						</div>
						<?php
					}
					?>
				</div>
				<?php
			}
			?>
		</div>
		<!-- 如果需要分页器 -->
		<div class="swiper-pagination page"></div>
	</div>
</div>

<script type="text/javascript">
	window.onload=function(){
		var mySwiper = new Swiper ('.swiper-container', {
			loop: false,

			// 如果需要分页器
			pagination: '.swiper-pagination',
			paginationClickable: true,
			paginationBulletRender: function (swiper, index, className) {
				return '<span class="' + className + '">' + (index + 1) + '</span>';
			},
		})
	}
</script>
